/*
{
"状态":1,
"名称":"删除-供应商信息",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"删除-供应商信息",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

declare @sql varchar(max)
declare @keys varchar(max)

set @keys = '{keys}'

set @sql = '
IF EXISTS(SELECT * FROM dbo.y_adjust WHERE supplier_id in ({ids}))
BEGIN
	DECLARE @supplier_name VARCHAR(100)
	DECLARE @Message VARCHAR(200)
    SELECT TOP 1 @supplier_name=supplier_name FROM dbo.b_supplier where supplier_id in ({ids})
	SET @Message=''SQL:''+@supplier_name+''已经发生业务,不允许删除''
	RAISERROR (@Message, 16 ,1 ) ; 
	RETURN  
END  

delete b_supplier where supplier_id in ({ids})'
set @sql = REPLACE(@sql, '{ids}', @keys)

exec(@sql)